import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index.vue'
Vue.use(VueRouter)

  const routes = [
    {
      path: "/login",
      name: "login",
      component: () => import("../views/login/login")
    },
    {
      path: '/',
      redirect: { name: "login" }
    },
    {
      path: '/index',
      name: 'index',
      component: index,
      children: [
        {
          path: "/addProject",
          name: "addProject",
          component: () => import("../views/project/addProject")
        }
      ]
    }
]

const router = new VueRouter({
  routes
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


export default router
